﻿using IBll;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Model;

namespace xushengqian.Api.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class EmpController : ControllerBase,IEmpBll
    {
        IEmpBll bll;
        public EmpController(IEmpBll bll)
        {
            this.bll = bll;
        }
        [HttpPost]
        public Task<int> AddEmp(Employee employee)
        {
            return bll.AddEmp(employee);
        }
        [HttpPost]
        public Task<int> AddEmpType(EmyployeeType emyployeeType)
        {
            return bll.AddEmpType(emyployeeType);
        }
        [HttpGet]
        public IQueryable<EmyployeeType> emyployeeTypes()
        {
            return bll.emyployeeTypes();
        }
        [HttpGet]
        public Employee Find(int id)
        {
            return bll.Find(id);
        }
        [HttpGet]
        public object getAll(int pageindex = 1, int pagesize = 3)
        {
            return bll.getAll(pageindex, pagesize);
        }
        [HttpPut]
        public Task<int> UpdateEmp(Employee employee)
        {
            return bll.UpdateEmp(employee);
        }
    }
}
